import request from '@/utils/request'
import qs from 'qs'

export const test = () => {
  return request({
    method: 'GET',
    url: '/business/web/hello'
  })
}


export const registered = data => {
  return request({
    method: 'POST',
    url: '/user/registered',
    data
  })
}

// 用户登录接口
export const login = data => {
  return request({
    method: 'POST',
    url: '/user/getUserToken',
    data
  })
}

// 用户基本信息接口
export const getUserInfo = () => {
  return request({
    method: 'GET',
    url: '/user/getUserInfo'
  })
}

// 修改用户信息
export const setUserInfo = data => {
  return request({
    method: 'POST',
    url: '/user/setUserInfo',
    data
  })
}

// 获取职位列表
export const getPositionList = () => {
  return request({
    method: 'GET',
    url: '/user/getPositionList'
  })
}
// 添加学习课程
export const learnCourse = data => {
  return request({
    method: 'POST',
    url: '/user/learnCourse',
    data
  })
}

export const delLearnCourse = params => {
  return request({
    method: 'DELETE',
    url: '/user/delLearnCourse',
    params
  })
}

// 获取学习的课程
export const getUserCourseList = () => {
  return request({
    method: 'GET',
    url: '/user/getUserCourseList'
  })
}

// 获取收藏课程
export const getUserCollectCourse = () => {
  return request({
    method: 'GET',
    url: '/user/getUserCollectCourse'
  })
}
// 收藏课程
export const collectCourse = data => {
  return request({
    method: 'POST',
    url: '/user/collectCourse',
    data
  })
}
// 获取收藏课程id
export const getUserCollectCourseId = () => {
  return request({
    method: 'GET',
    url: '/user/getUserCollectCourseId'
  })
}

// 获取购物车课程
export const getCartCourse = () => {
  return request({
    method: 'GET',
    url: '/user/getCartCourse'
  })
}
// 添加购物车课程
export const addCartCourse = data => {
  return request({
    method: 'POST',
    url: '/user/addCartCourse',
    data
  })
}
// 删除购物车课程
export const delCartCourse = params => {
  return request({
    method: 'DELETE',
    url: '/user/delCartCourse',
    params
  })
}





// 增加收货地址
export const setShippingAddress = data => {
  return request({
    method: 'POST',
    url: '/user/setShippingAddress',
    data
  })
}

// 获取所有收货地址
export const getShippingAddress = () => {
  return request({
    method: 'GET',
    url: '/user/getShippingAddress'
  })
}

// 修改收货地址
export const editShippingAddress = data => {
  return request({
    method: 'POST',
    url: '/user/editShippingAddress',
    data
  })
}

// 删除收货地址
export const delShippingAddress = (params) => {
  return request({
    method: 'DELETE',
    url: `/user/delShippingAddress`,
    params
  })
}

// 获取订单列表
export const getOrder = () => {
  return request({
    method: 'GET',
    url: '/user/getOrder'
  })
}